package com.starblink.frame.app.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.starblink.frame.app.base.BaseFragment
import com.starblink.frame.app.vm.MainVM
import com.starblink.frame.app.databinding.FragmentBlankBinding
import com.starblink.frame.app.myinterface.MainI


class BlankFragment : BaseFragment<FragmentBlankBinding, MainVM>() {

    private var mainI:MainI? = null
    companion object{
        fun newInstance(num:Int): BlankFragment {

            val blankFragment = BlankFragment()
            val bundle = Bundle()
            bundle.putInt("num",num)
            blankFragment.arguments = bundle
            return blankFragment
        }
    }

    override fun getViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): FragmentBlankBinding {
        return FragmentBlankBinding.inflate(inflater,container,false)
    }

    override fun startObserve() {

    }

    override fun initData() {
        mainI=activity as MainI
    }

    override fun initView(view: View) {
        val bundle = arguments
        val num = bundle?.getInt("num")
        viewBinding.btnBack.text = "sub Fragment:$num"
        viewBinding.btnBack.setOnClickListener {
            mainI?.subHomeFragment()
            popSelf()
        }
    }
}